feat: cache provisioned VM images for faster creates#23
Merged
ethannortharc merged 1 commit intomainfrom Mar 11, 2026
Merged
Conversation
After first `devbox create`, the fully-provisioned VM is cached as a reusable image. Subsequent creates with the same tool set launch from cache (~10s) instead of re-provisioning from scratch (~5min). Cache key = hash(image_type + sets + languages + mount_mode + nix config). Changing any nix set file automatically invalidates the cache. - Incus: uses native `incus publish`/`incus launch` from cached alias - Lima: copies diffdisk to ~/.devbox/cache/ (APFS clone for zero-cost) - Docker/Multipass: no-op (default trait stubs) - post_cache_setup() applies host-specific config (git, devbox binary) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
devbox create, the fully-provisioned VM is cached as a reusable imageincus publish/incus launchfrom cached alias~/.devbox/cache/(APFS clone for instant, zero-cost copy)post_cache_setup()re-applies host-specific config (git, devbox binary, state file)Test plan
cargo build— clean, no warningscargo test— all 71 tests pass (4 new cache key tests)devbox createon Incus — provisions normally, then cachesdevbox createwith same tools — launches from cache, skips provisioningdevbox createon Lima — provisions normally, then cachesdevbox createwith same tools on Lima — launches from cache🤖 Generated with Claude Code